/*
 * RawDexFile.h
 *
 *  Created on: 2011-7-16
 *      Author: gexiao
 */
/*
 * This represents a "raw" unswapped,unoptimized DEX file. We don't open
 * them directly, except to create the optimized version that we tuck in
 * the cache area.
 */
#ifndef RAWDEXFILE_H_
#define RAWDEXFILE_H_
/*
 * Structure representing a "raw" DEX file, in its unswapped unoptimized
 * state.
 */
typedef struct RawDexFile {
	char* cacheFileName;
	DvmDex* pDvmDex;
} RawDexFile;

/*
 * Open a raw ".dex" file, optimize it, and load it.
 *
 * On success, returns 0 and sets "*ppDexFile" to a newly-allocated DexFile.
 * On failure, returns a meaningful error code [currently just -1].
 */
int dvmRawDexFileOpen(const char* fileName, RawDexFile** ppDexFile,
		bool isBootstrap);

/*
 * Free a RawDexFile structure, along with any associated structures.
 */
void dvmRawDexFileFree(RawDexFile* pRawDexFile);

/*
 * Pry the DexFile out of a RawDexFile.
 */
INLINE DvmDex* dvmGetRawDexFileDex(RawDexFile* pRawDexFile) {
	return pRawDexFile->pDvmDex;
}

/* get full path of optimized DEX file */
INLINE const char* dvmGetRawDexFileCacheFileName(RawDexFile* pRawDexFile) {
    return pRawDexFile->cacheFileName;
}
#endif /* RAWDEXFILE_H_ */
